package com.jt.service;

import com.jt.mapper.RightsMapper;
import com.jt.mapper.UserMapper;
import com.jt.pojo.Rights;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RightsServiceImpl implements RightsService {

    @Autowired
    private RightsMapper rightsMapper;

    @Override
    public List<Rights> getRightsList() {
        int parentId = 0;
        List<Rights> oneList = rightsMapper.findParentById(parentId);

        for (Rights oneRights: oneList) {
            Integer oneId = oneRights.getId();
            List<Rights> twoList = rightsMapper.findParentById(oneId);
            oneRights.setChildren(twoList);
        }
        return oneList;
    }
}
